@font-face {
  font-family: "Inter Asset";
  src: url("assets/InterVariable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --primary: #05a55d;
  --on-primary: #ffffff;
  --on-surface: #121212;
  --outline: #e0e0e3;
  --surface-lowest: #e0e0e3;
  --hover-primary: rgba(5, 165, 93, 0.1);
  --hover-neutral: rgba(18, 18, 18, 0.1);
  --motion-standard: cubic-bezier(0.2, 0, 0, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: #f5f6f6;
  color: var(--on-surface);
  font-family: "Inter Asset", sans-serif;
}

button {
  font: inherit;
}

.demo-stage {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.install-control {
  --surface-fill: transparent;
  --surface-border: var(--outline);
  --surface-radius: 8px;
  position: relative;
  width: 78px;
  height: 46px;
  font-family: "Inter Asset", sans-serif;
  isolation: isolate;
}

.morph-shape {
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0;
  width: 78px;
  height: 32px;
  border: 1px solid var(--surface-border);
  border-radius: var(--surface-radius);
  background: var(--surface-fill);
  pointer-events: none;
  transition:
    opacity 220ms ease,
    border-color 240ms ease,
    background-color 240ms ease,
    box-shadow 120ms ease;
}

.primary-action {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  display: grid;
  width: 78px;
  min-width: 75px;
  height: 32px;
  padding: 6px 8px;
  place-items: center;
  border: 0;
  border-radius: var(--surface-radius);
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  outline: none;
  transition:
    color 220ms ease,
    opacity 180ms ease,
    transform 360ms var(--motion-standard);
}

.primary-action:focus-visible,
.cancel-action:focus-visible {
  outline: 2px solid var(--on-surface);
  outline-offset: 2px;
}

.button-label {
  font-size: 13px;
  font-weight: 600;
  font-feature-settings: "ss07" 1;
  line-height: 20px;
  white-space: nowrap;
  transition:
    opacity 160ms ease,
    transform 360ms var(--motion-standard);
}

.supporting-text {
  position: absolute;
  z-index: 1;
  top: 36px;
  left: 50%;
  color: var(--on-surface);
  font-size: 8px;
  font-weight: 400;
  font-feature-settings: "ss07" 1;
  line-height: 10px;
  white-space: nowrap;
  transform: translateX(-50%);
  transition:
    opacity 150ms ease,
    transform 320ms var(--motion-standard);
}

.progress-content {
  position: absolute;
  z-index: 3;
  inset: 0 0 auto;
  width: 78px;
  height: 34px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px) scale(0.94);
  transform-origin: center bottom;
  transition:
    opacity 180ms ease,
    transform 360ms var(--motion-standard);
}

.progress-topline {
  display: flex;
  width: 78px;
  height: 24px;
  align-items: center;
  gap: 6px;
}

.progress-value {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 400;
  font-feature-settings: "ss07" 1;
  line-height: 22px;
  font-variant-numeric: tabular-nums;
}

.cancel-action {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  padding: 4px;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  outline: none;
  transition: background-color 120ms ease;
}

.cancel-action img {
  display: block;
  width: 16px;
  height: 16px;
}

.cancel-action:hover,
.cancel-action:active {
  background: var(--hover-neutral);
}

.progress-track {
  position: absolute;
  top: 26px;
  left: 0;
  width: 78px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-lowest);
}

.progress-indicator {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--progress) * 1%);
  min-width: 0;
  border-radius: 999px;
  background: var(--primary);
  transform-origin: left center;
  transition: width 64ms linear;
}

.screen-reader-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.install-control[data-state="install"]:has(.primary-action:hover) .morph-shape,
.install-control[data-state="install"]:has(.primary-action:active) .morph-shape {
  box-shadow: inset 0 0 0 100px var(--hover-primary);
}

.install-control[data-state="progress"] .morph-shape,
.install-control[data-state="completing"] .morph-shape {
  opacity: 0;
  border-color: transparent;
  border-radius: 6px;
  background: var(--primary);
}

.install-control[data-state="progress"] .primary-action,
.install-control[data-state="completing"] .primary-action,
.install-control[data-state="cancelling"] .primary-action {
  opacity: 0;
  pointer-events: none;
  transform: translateY(7px) scaleX(0.82) scaleY(0.25);
}

.install-control[data-state="progress"] .button-label,
.install-control[data-state="completing"] .button-label,
.install-control[data-state="cancelling"] .button-label {
  opacity: 0;
  transform: translateY(6px) scale(0.82);
}

.install-control[data-state="progress"] .supporting-text,
.install-control[data-state="completing"] .supporting-text,
.install-control[data-state="cancelling"] .supporting-text {
  opacity: 0;
  transform: translate(-50%, -7px) scale(0.9);
}

.install-control[data-state="progress"] .progress-content {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.install-control[data-state="completing"] .progress-content {
  opacity: 0;
  pointer-events: none;
  transform: none;
}

.install-control[data-state="cancelling"] .progress-content {
  opacity: 0;
  pointer-events: none;
  transform: none;
}

.install-control[data-state="cancelling"] .morph-shape {
  opacity: 0;
  border-color: var(--outline);
  border-radius: 8px;
  background: transparent;
}

.install-control[data-state="completing"] {
  --surface-fill: var(--primary);
  --surface-border: transparent;
  --surface-radius: 6px;
}

.install-control[data-state="open"] {
  --surface-fill: var(--primary);
  --surface-border: transparent;
  --surface-radius: 6px;
}

.install-control[data-state="open"] .primary-action {
  color: var(--on-primary);
}

.install-control[data-state="open"]:has(.primary-action:hover) .morph-shape,
.install-control[data-state="open"]:has(.primary-action:active) .morph-shape,
.install-control[data-state="open"].is-pressed .morph-shape {
  box-shadow: inset 0 0 0 100px rgba(255, 255, 255, 0.1);
}

@media (prefers-reduced-motion: reduce) {
  .morph-shape,
  .primary-action,
  .button-label,
  .supporting-text,
  .progress-content {
    transition-duration: 1ms;
  }
}
